package com.wx.springboot.step7.controller;

import com.wx.springboot.step7.service.PermissionService;
import com.wx.springboot.step7.vo.PermissionVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "stream demo")
@RequestMapping("/stream")
@RestController
@Slf4j
public class PermissionController {
    @Autowired
    private PermissionService permissionService;

    @ApiOperation("Stream API测试")
    @GetMapping("/test")
    @ResponseBody
    public void streamTest() {
        permissionService.streamTest();
    }

    @ApiOperation("递归")
    @GetMapping("/tree")
    @ResponseBody
    public List<PermissionVo> treeList() {
        return permissionService.treeList();
    }
}
